<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="core" uri="http://java.sun.com/jsp/jstl/core" %>

<div id="new_component_main">
    <form:form id="newComponentFormRelation" commandName="newComponentCommandForm">
        <form:hidden id="dnc_validation_error" path="validationError"/>
        <form:hidden path="officeId"/>
        <form:hidden path="description"/>
        <form:hidden path="serial"/>
        <form:hidden path="typeId"/>
        <form:hidden path="buyDateString"/>
        <form:hidden path="warrantyEndDateString"/>
        <form:hidden path="status"/>

        <form:hidden id="dnc_computer_id" path="computerId"/>
        <form:hidden id="dnc_employee_id" path="employeeId"/>

        <form:hidden path="step"/>

        <table class="table no-border">
        <core:choose>
                <core:when test="${newComponentCommandForm.validationError == false}">
                    <col width="250">
                    <col>
                    <col width="0">
                </core:when>
                <core:otherwise>
                    <col width="250">
                    <col>
                    <col width="150">
                </core:otherwise>
            </core:choose>
        <tr>
                <td>
                    <label class="inline-block input-control checkbox" data-role="input-control">
                        <input type="checkbox" id="dnc_employee_check" onclick="dncChecked(this);">
                        <span class="check"></span>
                        Выдать сотруднику: 
                    </label>
                </td>
                <td class="input-control select" data-role="input-control">
                    <select id="dnc_select_employee" onchange="employeeChanged();">
                        <option value="-1">Выберите сотрудника</option>
                        <core:forEach items="${employeeList}" var="employee">
                            <option value="${employee.id}">${employee.surnameNamePatronymic}</option>
                        </core:forEach>
                    </select>
                </td>
                <td><form:errors path="employeeId"/></td>
         </tr>
            <tr>
                <td>
                    <label class="inline-block input-control checkbox" data-role="input-control">
                        <input type="checkbox" id="dnc_computer_check" onclick="dncChecked(this);">
                        <span class="check"></span>
                        Установить на оборудование:
                    </label>
                </td>
                <td colspan="2"></td>
            </tr>
            <tr>
                <td>Тип:</td>
                <td colspan="2" class="input-control select" data-role="input-control">
                    <input type="hidden" id="dnc_computer_type" name="dnc_computer_type">
                </td>
            </tr>
            <tr>
                <td>Устройство: </td>
                <td class="input-control select" data-role="input-control">
                    <select id="dnc_select_computer" onchange="computerChanged();">
                        <option value="-1">Выберите устройство</option>
                    </select>
                </td>
                <td><form:errors path="computerId"/></td>
            </tr>
            <tr>
                <td colspan="3">
                    <button id="dnc_submit" class="button place-right" type="button" onclick="submitNewComponent();">Зачислить</button>
                </td>
            </tr>
        </table>
    </form:form>
</div>